package myicesscheduler.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import myicesscheduler.hibernate.StringPoolTransaction;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import org.apache.log4j.Logger;

public class HelloController implements Controller {

   public ModelAndView handleRequest( HttpServletRequest request, HttpServletResponse response )
         throws Exception {

      Logger logger = Logger.getLogger( "MyLogger" );
      logger.warn( "Returning hello view" );

      final String aString = StringPoolTransaction.getString( 0 );

      final ModelAndView mv = new ModelAndView( "hello" );
      mv.addObject( "stringFromDatabase", aString );
      return mv;
   }

}
